﻿namespace Digitalmes.Domain.Entities.Mes.Processes;

/// <summary>
/// 工步。
/// </summary>
/// <remarks>工步与工序绑定，但还与产品关联。不同产品数量和参数值可能不同。</remarks>
[SugarTable("proc_operation_Step")]
public sealed class ProcOperationStep : AuditedEntity
{
    /// <summary>
    /// 工序 Id
    /// </summary>
    public long OpId { get; set; }

    /// <summary>
    /// 产品 Id
    /// </summary>
    public long ProductId { get; set; }

    /// <summary>
    /// 产品代码
    /// </summary>
    [NotNull]
    public string? ProductCode { get; set; }

    /// <summary>
    /// 工步索引
    /// </summary>
    public int Index { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    public string? Remark { get; set; }

    /// <summary>
    /// 是否将实际值与设定值进行比较，默认为 false。
    /// </summary>
    public bool IsCheck { get; set; }

    /// <summary>
    /// 启用状态（0->停用，1->启用）
    /// </summary>
    public EnabledStatusEnum Status { get; set; }

    /// <summary>
    /// 工步参数集合
    /// </summary>
    [NotNull]
    [Navigate(NavigateType.OneToMany, nameof(ProcOperationStepParam.StepId))]
    public List<ProcOperationStepParam>? Params { get; set; } = [];
}
